<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 
            需求：
                删除数组当中超过2次以上的元素
         */
        var arr =[1,88,456,2,45,67,88,90,877,20,11,67,88,88,67,11];

        // 第一步：先找出所有重复的元素
        var repplicaArr = [];
        for(var i=0;i<arr.length;i++){
            for(var j = i+1;j<arr.length;j++){
                if(arr[i]==arr[j]){
                    repplicaArr[repplicaArr.length] = arr[j];
                }
            }
        }

        console.log(repplicaArr);

        var resultArr = [];
        var count = 0;
        while(count<arr.length){
            var flag = false;
            for(var i = 0;i<repplicaArr.length;i++){
                if(arr[count] == repplicaArr[i]){
                    flag = true;
                }
            }
            if(!flag){
                resultArr[resultArr.length] = arr[count];
            }
            count++;
        }

        console.log(resultArr);
    </script>
</head>
<body>
    
</body>
</html>